#ifndef UIDHELPER_H
#define UIDHELPER_H

#include <QWidget>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QThread>
#include <Qtimer>
#include <QTextBlock>
#include <QSettings>
#include <QFileDialog>
#include <QMessageBox>
#include <QtMath>
#include <QStandardItemModel>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QStandardPaths>
#include <QDebug>
#include <QTranslator>
#include <QEvent>
#include <QDialog>
#include <QDialogButtonBox>
#include <QProcess>
#include <QScreen>
#include <QProgressBar>
#include <QDate>

QT_BEGIN_NAMESPACE
namespace Ui {
class UIDHelper;
}
QT_END_NAMESPACE

class UIDHelper : public QWidget
{
    Q_OBJECT

public:
    UIDHelper(QWidget *parent = nullptr);
    ~UIDHelper();

private slots:

    void on_btnopen_clicked();

    void on_charReadRadioButton_clicked();

    void on_btnrefresh_clicked();

    void on_btnrefresh_3_clicked();

    void on_btnrefresh_6_clicked();

    void readUID();

    void uiInit();

    QString toBase35(int number);

    QString dateToBase35(int year, int month, int day);

    void getDateNow();

    void focusNextLineEdit();

    void messlot();

    void MySleep(int msec);

    void on_btnrefresh_4_clicked();

private:
    Ui::UIDHelper *ui;
    QTimer *_scanPortTimer;
    QSerialPort m_serial;
    QString lastLine;
    QString devicename;
    QString newportName;
    QStringList lastPortNames;
    QString base35Date;

    bool at = 1;
    bool canRead = 0;
    qint64 frame = 0; // 当前帧数

    int year = 0; // 当前年份
    int month = 0; // 当前月份
    int day = 0; // 当前日期
    const QString base35Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
};
#endif // UIDHELPER_H
